package top.houry.test;

import io.grpc.ManagedChannel;
import io.grpc.ManagedChannelBuilder;
import top.houry.grpc.proto.OpenAPIGrpc;
import top.houry.grpc.proto.TestGrpc;

public class SingleRpcClient {
    public static void main(String[] args) {
        ManagedChannel managedChannel = ManagedChannelBuilder.forAddress("localhost", 9999).usePlaintext().build();
        OpenAPIGrpc.OpenAPIBlockingStub stub = OpenAPIGrpc.newBlockingStub(managedChannel);
        TestGrpc.Request build = TestGrpc.Request.newBuilder().setName("小猴子").build();
        TestGrpc.Response response = stub.singleRequest(build);
        System.out.println("调用结果:" + response.getMessage());
        managedChannel.shutdown();
    }
}
